<template>
	<view>
		<view class="uni-padding-wrap uni-common-mt">
			<view class="uni-btn-v">
				<navigator url="navigate/navigate?User=huanglaoliu&userid=999">
					<button type="default">跳转到新页面</button>
				</navigator>
				<button type="default" @click="goNewPage()">跳转到新页面</button>
				<navigator url="redirect/redirect" open-type="redirect">
					<button type="default">在当前页打开</button>
				</navigator>
				<navigator url="redirect/redirect" open-type="reLaunch">
					<button type="default">新建调用栈</button>
				</navigator>
				<navigator url="/pages/tabBar/tabcompage/tabcompage" open-type="switchTab">
					<button type="default">跳转tab页面</button>
				</navigator>
				<button type="default" @click="goRef()">自动刷新</button>
			</view>
		</view>
	<view v-for="index in count">
		<view style="height: 200rpx;background-color: yellow; margin: 10rpx; ">
			测试数据{{index}}
		</view>
	</view>
	<view style="text-align: center;color: #aaa; margin: 50rpx;"> ----真的没了-----</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				title: 'navigator',
				user: "huangshourong",
				uid: 455555,
				list:[1,2,3],
				count:20
			}
		},
		onLoad(options) { // oncreate
			console.log("navigator页面加载");
		},
		onShow() { // onStart
			console.log("navigator------onShow");
		},
		onPullDownRefresh() {
			console.log("navigator------onPullDownRefresh开始刷新");
			//数据更新
			
			setTimeout(()=>{
				uni.stopPullDownRefresh();
				console.log("navigator------刷新完成");
			},2000)
		},
		onReachBottom() {
			//数据加载
			console.log("到底了。。。。。。。。。。。。。。");
			if(this.count<200)
				this.count = this.count+20;
		},

		methods: {
			goRef(){
				uni.startPullDownRefresh({
					success() {
						console.log("navigator------success");
					},
					fail() {
						console.log("navigator------fail");
					},complete() {
						console.log("navigator------complete");
					}
				})
			},
			goNewPage() {
				
				this.list[10]
				
				uni.navigateTo({
					url:"/pages/tabcompage/navigator/navigate/navigate?User:"+this.user,
					success() {
						console.log("跳转成功");
					},fail(exp) {
						console.error("跳转失败: " + JSON.stringify(exp));
					}
					
				})
			}
		
		}
	}
</script>